function stdp_setup()
sf = getmainselection;
if(sf > 0)
    pflag = getplotflag;
    QueMessage('ltp setup', 1); % clear the que
    for i = 1:length(sf)
        ltps2(sf(i), pflag);
    end;
end;
return;

function ltps2(sf, pflag)

global CONTROL

proto = lower(CONTROL(sf).protocol);

switch proto
    case {'ap-iv2','ap-ivl'}
        CONTROL(sf).durho=10;
        CONTROL(sf).durs1=500;
    case 'timing_base'
        %% CONTROL(sf).stim = '[10]';
        %% CONTROL(sf).psp_time = '[8.5,12,60,80]'; % thse need to be manually setup.. every time.
        %   CONTROL(sf).durho = 275;
%         CONTROL(sf).durho = 225;
%         CONTROL(sf).durs1 = 50;
%         CONTROL(sf).psp_time = '[8.5, 14, 16, 80]';
        CONTROL(sf).durho = 110;
        CONTROL(sf).durs1 = 10;
        CONTROL(sf).psp_time = '[4.8, 7, 27, 87]';

    case {'timing_cond','tb_cond'}
        [st, df] = block_info(sf); % get the stim file info...
        stpulse = st.Duration.v; % array of pulse events...
        pulw = stpulse(2);
        a = find(stpulse == pulw); % find out how many are the "second" pulse stimulus width
        stdel = cumsum(stpulse);
        sv = '[';
        for i = 1:length(a)
            sv = [sv sprintf('%.1f', stdel(a(i)))];
            if(i < length(a))
                sv = [sv ','];
            end;
        end;
        sv = [sv ']'];

        CONTROL(sf).psp_time = sv;
        stdp_spike_dt(sf); % set up the dt measurement.
    otherwise
end;
